import request from '@/utils/request'
import { ApiModulesRoutes } from '@/consts.js'

//获取企业列表
export function ApiGetList(data) {
  return request({
    url: `${ApiModulesRoutes.USER}/enterprise/findEnterprisePageByParam`,
    method: 'POST',
    data,
  })
}

// 获取董监高列表，根据token
export function findSeniorExecutivePageByQualityInspection(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/SeniorExecutive/findSeniorExecutivePageByQualityInspection`,
    method: 'GET',
    params,
  })
}

// 根据ID删除对应高管
// SeniorExecutiveId {string} 
export function delSeniorExecutiveById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/SeniorExecutive/delSeniorExecutiveById`,
    method: 'GET',
    params,
  })
}

/** 修改高管信息
 * @param {string} id
 * @param {string} name  名字
 * @param {string} position 职位
 */
 export function updateSeniorExecutive(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/SeniorExecutive/updateSeniorExecutive`,
    method: 'POST',
    data: params,
  })
}

/** 添加高管信息
 * @param {string} name  名字
 * @param {string} position 职位
 * @param {string} enterpriseId  企业ID
 */
 export function addSeniorExecutive(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/SeniorExecutive/addSeniorExecutive`,
    method: 'POST',
    data: params,
  })
}

// 当前企业股东数据
export function findShareholderPageByQualityInspection(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/Shareholder/findShareholderPageByQualityInspection`,
    method: 'GET',
    params,
  })
}

// 根据ID删除股东
// ShareholderId {string} 
export function delShareholderById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/Shareholder/delShareholderById`,
    method: 'GET',
    params,
  })
}

/** 添加高管信息
 * @param {string} name  名字
 * @param {string} ratio  占比
 * @param {string} enterpriseId 企业ID
 */
 export function addShareholder(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/Shareholder/addShareholder`,
    method: 'POST',
    data: params,
  })
}

/** 修改高管信息
 * @param {string} id
 * @param {string} name  名字
 * @param {string} ratio  占比
 * @param {string} enterpriseId 企业ID
 */
 export function updateShareholder(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/Shareholder/updateShareholder`,
    method: 'POST',
    data: params,
  })
}

/** 根据园区内ID查询当前企业列表
 * @param {string} parkId
 */
 export function findEnterpriseListByParkId(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/enterprise/findEnterpriseListByParkId`,
    method: 'GET',
    params,
  })
}

/** 新增企业上下游
 * @param {string} enterpriseId  企业上下游ID
 * @param {string} enterpriseType  0上游服务，1下游供应
 * @param {string} supplierCustomerId 关联企业的ID
 */
 export function addSupplierCustomer(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/supplierCustomer/addSupplierCustomer`,
    method: 'POST',
    data: params,
  })
}

/** xiugai企业上下游
 * @param {string} id
 * @param {string} enterpriseId  企业上下游ID
 * @param {string} enterpriseType  0上游服务，1下游供应
 * @param {string} supplierCustomerId 关联企业的ID
 */
 export function updateSupplierCustomer(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/supplierCustomer/updateSupplierCustomer`,
    method: 'POST',
    data: params,
  })
}

// 删除对应的上下游
// tSupplierCustomerId 对应ID
export function delSupplierCustomerById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/supplierCustomer/delSupplierCustomerById`,
    method: 'GET',
    params,
  })
}

// 通过企业上下游数据 Id 查询企业上下游数据
// tSupplierCustomerId 对应ID
export function findSupplierCustomerById(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/supplierCustomer/findSupplierCustomerById`,
    method: 'GET',
    params,
  })
}

// 通过企业上下游数据 Id 查询企业上下游数据
/** 
  "pageNo": 0,
	"pageSize": 1000,
	"supplierCustomerVo": {
		"enterpriseId": "1410459245310459254",
		"enterpriseType": "1",
		"supplierCustomerId": ""
	}
*/
export function findSupplierCustomerPageByParam(params) {
  return request({
    url: `${ApiModulesRoutes.USER}/supplierCustomer/findSupplierCustomerPageByParam`,
    method: 'POST',
    data: params,
  })
}
